<template>
    <div class="fillcontain">
        <div class="table_container">
            欢迎使用扫一扫点餐系统
        </div>
    </div>
</template>

<script>
  import { baseUrl,baseImgPath } from '../../api/env';
    export default {
        data(){
            return {
                baseUrl,
                baseImgPath,
                loading:false,
                active:{
                  host:"",
                  endTime:"",
                  overDay:"",
                  code:"",
                },
            }
        },
        created(){
            this.initData();
        },
        methods: {
            initData(){
              this.loading = true;
              var that = this;
              that.$api.get('/super_admin/system_active', null, response => {
                if (response.status >= 200 && response.status < 300) {
                  var res = response.data;
                  if (res.code == 0) {
                    that.active.host = res.data.host;
                    that.active.endTime = res.data.endTime;
                    that.active.overDay = res.data.overDay;
                  }else{
                    this.$message({
                      message: res.msg,
                      type: 'warning'
                    });
                  }
                } else {
                  this.$message({
                    message: "服务器维护中",
                    type: 'error'
                  });
                }
                this.loading = false;
              });
            },
          save() {
                this.loading = true;
                var that = this;
                that.$api.post('/super_admin/system_active', {"code":this.active.code}, response => {
                  if (response.status >= 200 && response.status < 300) {
                    console.log(response.data);
                    var res = response.data;
                    if (res.code == 0) {
                      this.$message({
                        message: '激活成功',
                        type: 'success'
                      });
                      this.initData();
                    }else{
                      this.$message({
                        message: res.msg,
                        type: 'warning'
                      });
                    }
                  } else {
                    this.$message({
                      message: "服务器维护中",
                      type: 'error'
                    });
                  }

                });

                this.loading = false;
            },
        },
    }
</script>

<style lang="less">
	@import '../../style/mixin';
    .demo-table-expand {
        font-size: 0;
    }
    .demo-table-expand label {
        width: 90px;
        color: #99a9bf;
    }
    .demo-table-expand .el-form-item {
        margin-right: 0;
        margin-bottom: 0;
        width: 50%;
    }
    .table_container{
        padding: 20px;
        text-align: left;
    }
    .Pagination{
        display: flex;
        justify-content: flex-start;
        margin-top: 8px;
    }
    .avatar-uploader .el-upload {
        border: 1px dashed #d9d9d9;
        border-radius: 6px;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }
    .avatar-uploader .el-upload:hover {
        border-color: #20a0ff;
    }
    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 120px;
        height: 120px;
        line-height: 120px;
        text-align: center;
    }
    .avatar {
        width: 120px;
        height: 120px;
        display: block;
    }
</style>
